/*******************************************************************************
 * Package: com.song.boot.springstudy.redis.clean
 * Type:    RandomClean
 * Date:    2025/6/19 10:57
 *
 * Copyright (c) 2025 LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.song.boot.springstudy.redis.clean;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * 功能描述：随机清理
 *
 * @author Songxianyang
 * @date 2025/6/19 10:57
 */
public class RandomClean {
    public static void main(String[] args) {
        List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "David", "TianLuo");
        List<Object> objects = new ArrayList<>();
        for (String name : names) {
            objects.add(name);
        }

        Random random = new Random();
        int nextInt = random.nextInt(5);
        System.out.println(nextInt);
        // todo 阈值是5
        objects.remove(nextInt);
        System.out.println(objects.toString());
    }
}
